<template>
  <el-row>
    <el-col :span="24">
      <el-tabs v-model="activeName">
        <el-tab-pane label="退款信息" name="4">
          <keep-alive>
            <RefundInfo :refundData="refundData" :orderState="orderState"></RefundInfo>
          </keep-alive>
        </el-tab-pane>
        <el-tab-pane label="服务信息" name="1">
          <keep-alive>
            <service-info v-if="activeName == 1" :orderDetail="orderDetail" :id="id">
              <div slot="evaluation">
                <evaluation-detail :id="id" :evaluationDetail="evaluationDetail"></evaluation-detail>
              </div>
            </service-info>
          </keep-alive>
        </el-tab-pane>
        <el-tab-pane label="订单信息" name="2">
          <keep-alive>
            <order-info v-if="activeName == 2" :orderDetail="orderDetail" :id="id"></order-info>
          </keep-alive>
        </el-tab-pane>
        <el-tab-pane label="跟进记录" name="3">
          <keep-alive>
            <FollowUp v-if="activeName == 3" :id="id" :objectId="objectId" :objectType="objectType"></FollowUp>
          </keep-alive>
        </el-tab-pane>
      </el-tabs>
    </el-col>
  </el-row>
</template>
<script>
import RefundInfo from '@/views/fhb/myOrders/components/info/RefundInfo'
import OrderInfo from '@/views/fhb/myOrders/components/info/OrderInfo'
import ServiceInfo from '@/views/fhb/myOrders/components/info/ServiceInfo'
import QuotationRecordInfo from '@/views/fhb/myOrders/components/info/QuotationRecordInfo'
import evaluationDetail from '@/views/fhb/myOrders/components/detail/evaluationDetail'
import {unixTimestampFilter, filterDataBaseDictionary, decimalNumFilter} from '@/filters'
import FollowUp from '@/views/fhb/business/FollowUp'
export default {
  name: 'refundShow',
  components: {
    RefundInfo,
    FollowUp,
    OrderInfo,
    ServiceInfo,
    QuotationRecordInfo,
    evaluationDetail
  },
  filters: {
    decimalNumFilter,
    filterDataBaseDictionary,
    unixTimestampFilter
  },
  data() {
    return {
      id: this.$route.params.id,
      orderState: this.$route.query.orderState || '',
      activeName: this.$route.query.tab ? String(this.$route.query.tab) : '1',
      objectId: this.$route.query.objectId ? String(this.$route.query.objectId) : '',
      objectType: this.$route.query.objectType ? String(this.$route.query.objectType) : '',
      orderDetail: {},
      evaluationDetail: {},
      refundData: []
    }
  },
  created() {
    this.getDetail()
    this.getRefundDetail()
  },
  methods: {
    getRefundDetail() {
      this.$ajax.get('/ms-fahuobao-order/merRefund/getRefundDetail', {orderId: this.id}).then(response => {
        if (response.success) {
          this.refundData = response.data || []
        }
      })
    },
    getDetail() {
      this.$ajax.get('/ms-fahuobao-order/FhbOrder/findFhbOrderParticulars', {orderId: this.id}).then(response => {
        if (!response.data) {
          return
        }
        this.orderDetail = response.data
      })
    },
    getEvaluationDetail() {
      this.$ajax.get('/ms-fahuobao-order/FhbOrder/evaluation-detaile', {orderId: this.id}).then(response => {
        if (response) {
          this.evaluationDetail = response.data
        }
      })
    }
  }
}
</script>
